<?php
/* QQ:34734852
 * 业务联系：小鱼
 */
define('PATH', str_replace('\\', '/', dirname(__FILE__))  . '/');
include_once PATH . 'Def/Define.php';
include_once PATH . 'Function/Function.php';
include_once PATH . 'Class/RoutingDetection.Class.php';
include_once PATH . 'Class/Directory.Class.php';
include_once PATH . 'Class/Core.Class.php';

class EyouPHP extends Core{
	
	public static function Run() {
		return true;
	}
	
	public static function ERROR( $Msg = '', $Stop = false ) {
		include_once PATH . 'Template/Error_Write.tpl';
		unset( $Msg );
		if( !$Stop ) {
		   unset( $Stop, $Msg );
		   die; 
		}
		unset( $Stop, $Msg );
	}
	
}
if (  EyouPHP::Run() ) {
	ob_start();
	/*加载自定义函数模块*/
	if ( ((int)str_replace('.', '', PHP_VERSION) * 1)  >= 5300 ) { 
	   include_once str_replace('\\', '/', dirname(__FILE__) ) . '/extend/extendload_5.6.php';
	} else {
	   include_once str_replace('\\', '/', dirname(__FILE__) ) . '/extend/extendload_5.2.php';
	}
	/*加载自定义函数模块*/
	$AREA = ROOT . APP . '/Action/' . AREA . '/Load.Class.php';
	file_exists( $AREA ) or EyouPHP::ERROR('区域' . AREA . '未找到');
	include_once $AREA;
	$Start = AREA;
	$MODU = ROOT . APP . '/Action/' . AREA . '/' . MODU . 'Action.Class.php';
	file_exists( $MODU ) or EyouPHP::ERROR('模块' . MODU . '未找到');
	include_once $MODU;
	$ClassName = MODU . 'Action';
	class_exists($ClassName) or EyouPHP::ERROR('无法加载模块' . MODU );
	$Object = new $ClassName();
	method_exists( $Object, 'auto' ) or  EyouPHP::ERROR('区域' . AREA . '或模块' . MODU . '中必须存在auto()方法' );
	$Object -> auto(array_merge(array('q' => AREA, 'm' => MODU, 'a' => ACTI), $Parameter));
	!method_exists( $Object, 'setting' ) or $Object -> setting();
	$Action = ACTI;
	method_exists( $Object, $Action ) or  EyouPHP::ERROR('动作' . $Action  . '未加载' );
	$Object -> $Action($Parameter);
	$Object = null;
	unset( $Action, $AREA, $ClassName, $MODU, $Object, $Parameter );
	if ( function_exists('tidy_parse_string') && YIDYOPEN ) {
	  $EndContent = tidy_parse_string( ob_get_contents(), array('indent' => true, 'output-xhtml' => true, 'show-body-only' => false), 'UTF8');
	} else {
	  $EndContent = ob_get_contents();
	}
	ob_end_clean();
	echo $EndContent, $k;
	unset( $EndContent );
}
